From: Keir Fraser Date: Wed, 21 Oct 2009 07:50:23 +0000 (+0100) Subject: x86: MSI: Mask/unmask msi irq during the window which programs msi. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13194 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=d9e4801c022e6a503454e23d8eef3ff90f30ed6f;p=xen.git x86: MSI: Mask/unmask msi irq during the window which programs msi. When program msi, it has to mask it first, otherwise, it may generate inconsistent interrupts. According to spec, if not masked, the interrupt generation behaviour is undefined. Signed-off-by: Xiantao Zhang --- diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index 261da58185..6bf4e6ef69 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -231,6 +231,7 @@ static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) u8 slot = PCI_SLOT(dev->devfn); u8 func = PCI_FUNC(dev->devfn); + mask_msi_irq(entry->irq); pci_conf_write32(bus, slot, func, msi_lower_address_reg(pos), msg->address_lo); if ( entry->msi_attrib.is_64 ) @@ -243,6 +244,7 @@ static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) else pci_conf_write16(bus, slot, func, msi_data_reg(pos, 0), msg->data); + unmask_msi_irq(entry->irq); break; } case PCI_CAP_ID_MSIX: @@ -250,11 +252,13 @@ static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) void __iomem *base; base = entry->mask_base; + mask_msi_irq(entry->irq); writel(msg->address_lo, base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); writel(msg->data, base + PCI_MSIX_ENTRY_DATA_OFFSET); + unmask_msi_irq(entry->irq); break; } default: